import { defineStore } from 'pinia'
import Menu from '@/types/menu'

const useSidebarStore = defineStore('sidebar', {
  state: () => ({
    collapse: false,
    menuList: [] as Menu[]
  }),
  persist: true, // 添加 persist 属性
  getters: {
  },
  actions: {
    setMenuList(list: Menu[]) {
      this.menuList = list
    },
    handleCollapse() {
      this.collapse = !this.collapse
    }
  }
})

export default useSidebarStore
